package com.one.common.receiver;

import com.one.common.common.order.extra.ReserveExtra;
import com.one.common.config.RouterPath;
import com.one.common.manager.RouterManager;
import com.one.common.model.extra.DefaultExtra;
import com.one.common.utils.StringUtils;

/**
 * Author: zhulunjun
 * Email: zhulunjun@qq.com
 * CreateDate: 2018/11/14 19:31
 * Description：
 * 1 师傅端
 * 3, 4, 5 一键报修
 * 6, 7, 8 装修设计订单
 * 9, 10 设计加配
 **/
public class PushStateHandler {

    private static final String J_1 = "1";
    private static final String J_2 = "2";
    private static final String J_3 = "3";
    private static final String J_4 = "4";
    private static final String J_5 = "5";
    private static final String J_6 = "6";
    private static final String J_7 = "7";
    private static final String J_8 = "8";
    private static final String J_9 = "9";
    private static final String J_10 = "10";

    /**
     * 跳转
     */
    public static void toPage(JpushBean jpushBean) {
        if (jpushBean == null) {
            RouterManager.getInstance().go(RouterPath.MAIN_PAGE);
        }
        if (StringUtils.isBlank(jpushBean.getType())) {
            jpushBean.setType(J_1);

        }
        switch (jpushBean.getType()) {
            case J_1: // 订单详情
            case J_3:
            case J_4:
            case J_5:
                RouterManager.getInstance().go(RouterPath.ORDER_DETAIL, new DefaultExtra(jpushBean.getOrder_id() + ""));
                break;
            case J_6: // 装修设计订单
            case J_7:
            case J_8:
                RouterManager.getInstance().go(RouterPath.DE_ORDER_DETAIL,
                        new ReserveExtra(jpushBean.getOrder_type(), jpushBean.getOrder_id() + ""));
                break;
            case J_9: // 定制加配
            case J_10:
                RouterManager.getInstance().go(RouterPath.CU_ORDER_DETAIL,
                        new DefaultExtra(jpushBean.getOrder_id() + ""));
                break;
            default:
                RouterManager.getInstance().go(RouterPath.MAIN_PAGE);
                break;
        }


    }
}
